﻿Imports DAO
Imports System.Data.OleDb

Public Class ThuVienChungBUS
    Public Function LayBang(ByVal sql As String) As DataTable
        Dim dt As New DataTable
        dt = DataProvider.DocBang(sql)
        Return dt
    End Function

    Public Shared Function LayTenLop(ByVal malop As Integer) As String
        Dim strSQL As String = "Select TenLop From LOP WHERE MaLop=" + malop.ToString()
        Dim conn As OleDbConnection = DataProvider.ConnectDB()
        Dim cmd As New OleDbCommand(strSQL, conn)
        Dim tenlop As String = cmd.ExecuteScalar()
        conn.Close()
        Return tenlop
    End Function

    Public Shared Function ChayQuery(ByVal strSQL As String) As Integer
        Dim conn As OleDbConnection = DataProvider.ConnectDB()
        Dim cmd As New OleDbCommand(strSQL, conn)
        Dim r As Integer = cmd.ExecuteNonQuery
        conn.Close()

        If r = 1 Then
            Return 1
        Else
            Return 0
        End If
    End Function
End Class
